package org.nepu.scr.indexrate.converter.drillingrate.jobsupport;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.drillingrate.jobsupport.Sealing;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class SealingConverter implements AttributeConverter<Sealing, String> {
    @Override
    public String convertToDatabaseColumn(Sealing sealing) {
        return JSONUtil.toJsonStr(sealing);
    }

    @Override
    public Sealing convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, Sealing.class);
    }
}
